package com.enzoism.java;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Destination;

/**
 * Created with IntelliJ IDEA.
 * User: enzoism
 * Date: 2019/6/26- 0:52
 */
@Component
public class AlarmProducer {

    @Autowired
    private JmsTemplate jmsTemplate;
    // private JmsMessagingTemplate jmsTemplate;
    // 也可以注入JmsTemplate，JmsMessagingTemplate对JmsTemplate进行了封装

    // 数据存放到消息队列中
    public void sendMessage(Destination destination, String message){
        this.jmsTemplate.convertAndSend(destination,message);
    }




}
